package increment3.statics;

import java.io.Serializable;
import java.util.ArrayList;

public class Student implements Serializable {
    private final String status = "Student";
    private String name;
    private String pwd;
    private ArrayList<String> his_lst = new ArrayList<>();
    public Student(String name, String pwd){
        this.name = name;
        this.pwd  = pwd;
    }
    public void addHistory(String his){
        this.his_lst.add(his);
    }
    public ArrayList<String> getHistory(){
        ArrayList<String> hst = new ArrayList<String>();
        hst.addAll(this.his_lst);
        return hst;
    }
    @Override
    public boolean equals(Object obj) {
         if(!(obj instanceof Student)){
             return false;
         }
         Student stu = (Student) obj;
         if(stu.name.equals(this.name) && stu.status.equals(this.status)){
             return true;
         }
         return false;
    }

    public String getPwd() {
        return pwd;
    }
    @Override
    public int hashCode(){
        return this.name.hashCode() + this.status.hashCode();
    }
    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", pwd='" + pwd + '\'' +
                '}';
    }

}
